<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        //输入框鼠标聚焦后，展示小写；鼠标离焦后，展示大写。
        function a() {
            var name = document.querySelector("#name");
            name.value = name.value.toLowerCase();//转小写

        }

        function b() {
            var name = document.querySelector("#name");
            name.value = name.value.toUpperCase();//转大写
        }

    </script>
</head>

<body>
    <input type="text" value="HXZY" id="name" onblur="b()" onfocus="a()" placeholder="sdfdsf">

</body>

</html>